#include <bits/stdc++.h>
using namespace std;

int n,m;
int a[105][105],b[105][105];
void to_0(int x,int y){
    for (int i = 1; i <= n; ++i)
        b[i][y]=0;
    for (int j = 1; j <= m; ++j)
        b[x][j]=0;
}

int main(){
    cin>>n>>m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin>>a[i][j];
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            b[i][j]=a[i][j];
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            if (a[i][j] == 0)
                to_0(i, j);
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j)
            cout << b[i][j] << ' ';
        cout<<endl;
    }
    return 0;
}